package Interview;

import java.util.Scanner;

/**
 * Created by loso on 2017/3/30.
 */
public class _toutiao_2017330Test3 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextLine()){
            String s = in.nextLine();

            int max = 0;
            int count = 0;
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i)=='['){
                    count++;
                    max = max>count?max:count;
                }
                else{
                    count--;
                }
            }
            count = max;
            StringBuilder[] stringBuilders = new StringBuilder[max];
            stringBuilders[max-1] = new StringBuilder();
            stringBuilders[max-1].append('+');
            for (int j = 0; j < max * 2 - 1; j++) {
                stringBuilders[max-1].append('-');
            }
            stringBuilders[max-1].append('+');

            for (int i = 0; i < max-1; i++) {
                stringBuilders[i] = new StringBuilder();
                for (int j = 0; j < max - i -2; j++) {
                    stringBuilders[i].append(' ');
                }
                stringBuilders[i].append("|+");
                for (int j = 0; j < i * 2 + 1; j++) {
                    stringBuilders[i].append('-');
                }
                stringBuilders[i].append("+|");
//                for (int j = 0; j < max - i -2; j++) {
//                    stringBuilders[i].append(' ');
//                }
            }

            StringBuilder[] sbspace = new StringBuilder[max];

            sbspace[max-1] = new StringBuilder();
            sbspace[max-1].append('|');
            for (int j = 0; j < max*2 - 1; j++) {
                sbspace[max-1].append(' ');
            }
            sbspace[max-1].append('|');



            for (int i = 0; i < max - 1; i++) {
                sbspace[i] = new StringBuilder();
                for (int j = 0; j < max - i - 1; j++) {
                    sbspace[i].append(' ');
                }
                sbspace[i].append('|');
                for (int j = 0; j < i*2+1; j++) {
                    sbspace[i].append(' ');
                }
                sbspace[i].append('|');
//                for (int j = 0; j < max - i - 1; j++) {
//                    sbspace[i].append(' ');
//                }
            }

            StringBuilder stringBuilderss = new StringBuilder();

            for (int i = 0; i < s.length() -1; i++) {
                stringBuilderss.append(stringBuilders[count-1]+"\r\n");
                if (s.charAt(i)=='[' && s.charAt(i+1)==']'){
                    stringBuilderss.append(sbspace[count-1]+"\r\n");
                    stringBuilderss.append("\r\n");
                    stringBuilderss.append(sbspace[count-1]+"\r\n");
                }
                if (s.charAt(i)!=s.charAt(i+1)) {
                }
                else if (s.charAt(i)=='['){
                    count--;
                    if (count ==0){
                        count = 1;
                    }
                }
                else{
                    count++;
                }
            }
            stringBuilderss.append(stringBuilders[count-1]);
            System.out.println(stringBuilderss);
        }
    }
}
